<?php

// 初期設定
if (!defined("IN_APP")) {
	define("IN_APP", true);
	include_once("../../include/init.php");
	requireLogin();
}

//　タブ別の設定の読み込み
require_once("tab.include.php");

// ページ名
$page_name = "profile.tab";

/******************* ページの処理　*******************/

$connect = connectToDb();

$query = sprintf("SELECT * FROM users WHERE user_id = %s ", 
								mysql_real_escape_string($_SESSION['user_id']));
$query.= "AND (del_flag <> 'd' OR del_flag IS NULL)";


$result = mysql_query($query, $connect);

if ( !$result ) {
	exit('Invalid query: $query - ' . mysql_error());
}
else {
	$row = mysql_fetch_assoc($result);
	
	$name = $row['name'];
	$email = $row['email'];
	$birthdate = $row['birthdate'];
	
	if (empty($name) || empty($email) || empty($birthdate)) {
		$message = $MESSAGES['FIRST_LOGIN'];
		$profile_unfilled = true;
	}
	else
		$profile_unfilled = false;
}


/******************** 処理終了 ********************/

//　ページを表示する
$include_path = $SETTINGS['VIEW_PATH'] . $tab_name . "/" . $page_name . $SETTINGS['VIEW_NAME'];
include($include_path);

?>